"use strict";
/*
    jwt认证
*/
const jwt = require('jsonwebtoken');


const appSecret = 'c30729528bd4af7d04bf48b0387c1cad12456';

// 加密
function getToken (accounts) {
	return jwt.sign({accounts: accounts},appSecret,{expiresIn: 60*60*24});
}

// 解密
function verifyToken (token) {
	return jwt.verify(token,appSecret)
}

module.exports = {
	appSecret: appSecret,
	getToken: getToken,
	verifyToken: verifyToken
}